<template>
    <div>
      <el-row type="flex" justify="end" align="center" style="padding: 15px 0;">
        <el-button type="primary" plain size="mini" @click="addModel()">新建运费模板</el-button>
      </el-row>
      <pt-table
        :columns="columns"
        :dataSource="tableData"
        :options="options"
        :fetch="getTableList"
        :pagination="pagination"
      />
    </div>
</template>

<script>
  export default {
    data() {
      return {
        columns: [
          // 表单配置
          {
            label: "模板名称", minWidth: 140, align: "left",
            render: row => {
              return <div row={row}>{row}</div>;
            }
          },
          {
            button: true, label: "操作", width: 60,
            group: [
              {name: "查看", type: "text", onClick: row => this.addModel(row.id)}
            ]
          }
        ],
        pagination: {total: 0, page: 0, size: 10, curPage: 1}, // 分页
        options: { // 表单外观
          mutiSelect: false, //  多选则 mutiSelect
          index: false, // 显示序号
          loading: false, // 表格动画
          initTable: true, // 是否一挂载就加载数据
          expand: true // 折叠
        },
        tableData: [], //表单数据
        deliveryDialog: true // 新增修改模板弹窗
      }
    },
    methods: {
      getTableList() { // 运费模板列表
        /*this.options.loading = true
        const params = {...this.params }
        params.page = this.pagination.page
        params.size = this.pagination.size
        params.busniessId = this.$route.query.id
        /api.busList(params).then(res => {
          if (res.success) {
            this.tableData = res.data.list
            this.pagination.total = res.data.total
          }
        }).finally(() => {
          this.options.loading = false
        }) */
      },
     
      addModel(cid) { // 打开新增模板
        this.$router.push({
          path: '/main/sc_shop/addDelivery',
          query: { id: this.$route.query.id, cid }
        })
      }
    },
    mounted() {
      this.getTableList()
    }
  }
</script>

<style scoped>

</style>
